home *** CD-ROM | disk | FTP | other *** search
/ Gamers Delight 2 / Gamers Delight 2.iso / Aminet / game / misc / attacks.lzh / Attacks / Sources / attacksgraphics.def < prev    next >
Text File  |  1992-04-15  |  12KB  |  213 lines

  1. DEFINITION MODULE attacksgraphics;
  2.  
  3.  
  4. (*   I am using the data hiding capabilities of modula-2 to simplify my   *)
  5. (* life for this project.  Anything that the main or other routines could *)
  6. (* want to do graphically will be through routines declared here.  To     *)
  7. (* sum, this is the heart of the graphics routines, simplified to only    *)
  8. (* the logical necessities.                                               *)
  9. (*                                                                        *)
  10. (*      Scott Biggs                                                       *)
  11.  
  12.  
  13. FROM header
  14.   IMPORT   boardtype, playertype, squaretype, boardrange, pointercode,
  15.            movetype, printmsgtype;
  16. FROM SYSTEM
  17.   IMPORT   ADDRESS;
  18. FROM Intuition
  19.   IMPORT   WindowPtr;
  20.  
  21.  
  22. (**************************************************************************)
  23. PROCEDURE InitializeScreen() : BOOLEAN;
  24.  
  25. (*      Starts the graphix running.                                    *)
  26. (* Sets up all the graphics variables AND draws the first graphics     *)
  27. (* that will be presented.  It returns true IF all the actions worked, *)
  28. (* false otherwise.                                                    *)
  29. (*                                                                     *)
  30. (*   INPUT                                                             *)
  31. (*            n/a                                                      *)
  32. (*                                                                     *)
  33. (*   OUTPUT                                                            *)
  34. (*            Returns a boolean value that tells IF the operation was  *)
  35. (*            succussful or not.  If successful, the screen (along     *)
  36. (*            with the accompanying graphics) is started.              *)
  37.  
  38.  
  39. (**************************************************************************)
  40. PROCEDURE CleanupGraphics;
  41.  
  42. (*      Stops the graphix AND deallocates all graphix allocated        *)
  43. (* memory.  It assumes that the graphics HAS been succussfully initi-  *)
  44. (* ated.                                                               *)
  45. (*                                                                     *)
  46. (*   INPUT                                                             *)
  47. (*            n/a                                                      *)
  48. (*                                                                     *)
  49. (*   OUTPUT                                                            *)
  50. (*            n/a                                                      *)
  51.  
  52.  
  53.  
  54. (**************************************************************************)
  55. PROCEDURE ShowAbout;
  56.  
  57. (*   Simply displays a message about the programmer and then waits for *)
  58. (* a mouse click to then erase this new display and return to the old  *)
  59. (* one.                                                                *)
  60.  
  61.  
  62.  
  63. (**************************************************************************)
  64. PROCEDURE ChangePointer (code : pointercode);
  65.  
  66. (*      This changes the mouse pointer.  The code determines what the  *)
  67. (* pointer is changed to.                                              *)
  68. (*                                                                     *)
  69. (*   INPUT                                                             *)
  70. (*            code        This variable is of the enumerated type,     *)
  71. (*                        pointercode.  It consists of RedCircle,      *)
  72. (*                        BlueCircle, and Default.  The Default code   *)
  73. (*                        tells this routine to restore the pointer    *)
  74. (*                        to whatever it was when the program was      *)
  75. (*                        started.                                     *)
  76. (*                                                                     *)
  77. (*   OUTPUT                                                            *)
  78. (*            The mouse pointer is immediately changed to the desired  *)
  79. (*            pointer.                                                 *)
  80.  
  81.  
  82. (**************************************************************************)
  83. PROCEDURE PrintMsg (msg : printmsgtype);
  84.  
  85. (*   Prints the message at the top of the screen.  This procedure should  *)
  86. (* not be confused with the procedure PrintTurn, which displays who's     *)
  87. (* turn it is to play.                                                    *)
  88. (*                                                                        *)
  89. (*   INPUT                                                                *)
  90. (*            msg                  This is which message to display.      *)
  91. (*                                                                        *)
  92. (*   OUTPUT                                                               *)
  93. (*            The screen is changed to display the desired message.       *)
  94.  
  95.  
  96. (**************************************************************************)
  97. PROCEDURE ShowScore (redscore : CARDINAL; bluescore : CARDINAL);
  98.  
  99. (*      Displays the scores.                                           *)
  100. (*                                                                     *)
  101. (*   INPUT                                                             *)
  102. (*            redscore    The number of squares occupied by the red    *)
  103. (*                        player.                                      *)
  104. (*                                                                     *)
  105. (*            bluescore   The number of squares occupied by the blue   *)
  106. (*                        player.                                      *)
  107. (*                                                                     *)
  108. (*   OUTPUT                                                            *)
  109. (*            The screen is modified to display the scores.            *)
  110.  
  111.  
  112. (**************************************************************************)
  113. PROCEDURE PrintTurn (player : playertype);
  114.  
  115. (*      Displays whose turn it is by the message on the top of the     *)
  116. (* screen                                                              *)
  117. (*                                                                     *)
  118. (*   INPUT                                                             *)
  119. (*            player      The player whose turn it now is.             *)
  120. (*                                                                     *)
  121. (*   OUTPUT                                                            *)
  122. (*            The screen is modified to display whose turn it is.      *)
  123.  
  124. (**************************************************************************)
  125. PROCEDURE DrawBoard (board : boardtype);
  126.  
  127. (*      Replaces the current display with the given board.             *)
  128. (*                                                                     *)
  129. (*   INPUT                                                             *)
  130. (*            board       A variable OF boardtype that describes the   *)
  131. (*                        contents of every location of a board.       *)
  132. (*                                                                     *)
  133. (*   OUTPUT                                                            *)
  134. (*            The screen is modified to display the contents of the    *)
  135. (*            input data.                                              *)
  136.  
  137.  
  138. (***********************************************************************)
  139. PROCEDURE DrawSquare (xloc : boardrange; yloc : boardrange;
  140.                       square : squaretype);
  141.  
  142. (*      This routine modifies only a single square, rather than the    *)
  143. (* whole board like the DrawBoard routine does.  Considering the upper *)
  144. (* left corner as square (1,1), this routine will replace the given    *)
  145. (* square with the specified item (either a block, empty, red, or      *)
  146. (* blue).                                                              *)
  147. (*                                                                     *)
  148. (*   INPUT                                                             *)
  149. (*            xloc, yloc     These two numbers describe the location   *)
  150. (*                           of the square to change.                  *)
  151. (*                                                                     *)
  152. (*            square         This tells the routine what to change     *)
  153. (*                           the square to.                            *)
  154. (*                                                                     *)
  155. (*                                                                     *)
  156. (*   OUTPUT                                                            *)
  157. (*                     The display is change so that only the square   *)
  158. (*                     indicated looks like the new type.              *)
  159.  
  160. (***********************************************************************)
  161. PROCEDURE HighlightSquare (xloc : boardrange; yloc : boardrange;
  162.                       player : playertype);
  163.  
  164. (*      This routine highlights the given square in the color of the   *)
  165. (* specified player.  It is assumed that checking has already been     *)
  166. (* made so that the highlighting makes sense.                          *)
  167. (*                                                                     *)
  168. (*   INPUT                                                             *)
  169. (*            xloc, yloc     These two numbers describe the location   *)
  170. (*                           of the square to change.                  *)
  171. (*                                                                     *)
  172. (*            player         This tells the routine what colors to     *)
  173. (*                           use.                                      *)
  174. (*                                                                     *)
  175. (*                                                                     *)
  176. (*   OUTPUT                                                            *)
  177. (*                     The display is change so that only the square   *)
  178. (*                     indicated looks highlighted.                    *)
  179.  
  180.  
  181. (***********************************************************************)
  182. PROCEDURE UnHighlightSquare (xloc : boardrange; yloc : boardrange;
  183.                              player : playertype);
  184.  
  185. (*      This routine UNhighlights the given square.  It undoes the     *)
  186. (* effects of HighlightSquare.  Similarly, it assumes that checking    *)
  187. (* has already been done so that unhighlighting makes sense.           *)
  188. (*                                                                     *)
  189. (*   INPUT                                                             *)
  190. (*            xloc, yloc     These two numbers describe the location   *)
  191. (*                           of the square to change.                  *)
  192. (*                                                                     *)
  193. (*            player         This is the color of the square to UN-    *)
  194. (*                           highlight.                                *)
  195. (*                                                                     *)
  196. (*   OUTPUT                                                            *)
  197. (*                     The display is change so that only the square   *)
  198. (*                     indicated looks UNhighlighted.                  *)
  199.  
  200.  
  201. (***********************************************************************)
  202. (*   !!!!!    WARNING     !!!!!                                        *)
  203. (*                                                                     *)
  204. (*   The stuff after this message should only be imported by the       *)
  205. (* module, ataxxinput.  Only that module needs to know about these     *)
  206. (* things!                                                             *)
  207. (***********************************************************************)
  208.  
  209. VAR
  210.   mywindowptr : WindowPtr;
  211.  
  212. END attacksgraphics.
  213.